import store from "@/store";

export function checkPermission(value, modelId) {
  if (!value || !modelId) {
    return true;
  }
  const permissionList = store.getters && store.getters.permissionList;
  const list = permissionList.filter((o) => o.modelId === modelId);
  if (list.length == 0) {
    return false;
  }
  const btnList = list[0] && list[0].button ? list[0].button : [];
  if (btnList.length == 0) {
    return false;
  }
  return btnList.some((btn) => btn.enCode === value);
}
